package com.zlfund.cat.zjgsmk.adapter;

import android.view.View;

import com.zhy.autolayout.utils.AutoUtils;
import com.zlfund.cat.zjgsmk.R;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by chenjun on 2017/8/18.
 */

public class ListViewHolder {
    private Map<Integer, View> mViews;
    private View mItemView;
    private int mType;

    public ListViewHolder(View itemView) {
        mViews = new HashMap<>();
        mItemView = itemView;
        AutoUtils.auto(mItemView);
    }

    private void addView(int resId, View v) {
        mViews.put(resId, v);
    }

    public <T extends View> T getView(int resId, Class<T> clazz) {
        View v = null;
        if (!mViews.containsKey(resId)){
            v = mItemView.findViewById(resId);
            addView(resId,v);
        }else {
            v = mViews.get(resId);
        }
        return (T) v;
    }

    public int getmType() {
        return mType;
    }

    public void setmType(int mType) {
        this.mType = mType;
    }
}
